#ifndef _NRF24_NRF24_APP_H_
#define _NRF24_NRF24_APP_H_

#include "main.h"
#include "spi.h"
#include "NRF.h"
#include "UART/uart_app.h"
#include "MOTOR/motor_app.h"
#include "SERVO/servo_app.h"
#include "SENSOR\sensor_app.h"

//-----------------------------------------------	

typedef struct ADC_deviation_value {
    uint16_t ADC_Air_target[4];
    uint16_t ADC_Water_target[4];
    uint16_t ADC_Air_range[4];
    uint16_t ADC_Water_range[4];
}ADC_Dev_val;

typedef enum _BOOL{
    false = 0,
    true = 1
}bool;

//-----------------------------------------------	

#define JOYSTICK_DEADZONE    50
#define JOYSTICK_DEADZONE_UP    130
#define JOYSTICK_DEADZONE_DOWN  120


//-----------------------------------------------	

extern ADC_Dev_val ADC_dev_val;

extern double Water_depth_val;
extern double Water_sample_val;

extern uint16_t C_TIM2_IT_Update;		// TIM3的定时计次

extern uint16_t C_2G4_Command;			// 2.4G指令计时

extern uint8_t  F_2G4_Command_Valid;	// 2.4G命令有效标志位

extern uint16_t motor_start_flag;
extern uint16_t water_measure_flag;

extern uint16_t water_sample_flag;
extern uint16_t water_depth_flag;
extern uint16_t watch_dog_flag;
extern uint16_t GNSS_flag;
extern uint16_t SENSOR_flag;

extern uint8_t AUTO_MOVE_TURN;

extern uint8_t AUTO_MOVE_TURN_L;
extern uint8_t AUTO_MOVE_TURN_R;

extern bool ADC_DATA_Dispose_status;
//-----------------------------------------------

/**
 * @if Eng 
 * @brief Initializes the NRF24L01 wireless transceiver module 
 * @param None
 * @result NRF24L01 module is configured with default settings and ready for communication
 * @else
 * @brief 初始化NRF24L01无线收发模块
 * @param 无
 * @result NRF24L01模块被配置为默认设置并准备通信
 * @endif 
 */
void NRF24_Init(void);

/**
 * @if Eng 
 * @brief Processes received data from NRF24L01 module 
 * @param RF2G4_Receive_Data - Pointer to buffer containing received data
 * @result Received data is processed and stored in application data structures
 * @else
 * @brief 处理从NRF24L01模块接收的数据 
 * @param RF2G4_Receive_Data - 指向包含接收数据的缓冲区的指针
 * @result 接收的数据被处理并存储在应用数据结构中 
 * @endif 
 */
void RX_Dispose(uint8_t *RF2G4_Receive_Data);

#endif


